package com.srlg.boot.controller;

import com.srlg.boot.model.dto.TestDTO;
import com.srlg.boot.service.TestService;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @desc:
 * @author: srlg li
 * @date: 2025/7/8 下午9:39
 */
@RestController
@RequiredArgsConstructor
public class TestController {

    private final TestService testService;

    @PostMapping("/test-validation")
    @SneakyThrows
    public TestDTO testValidation(@RequestBody @Validated TestDTO testDTO) {
        return this.testService.service(testDTO);
    }


    @GetMapping(value = "/returnString", produces = "application/json; charset=UTF-8")
    public String returnString() {
    return"success";
    }
}
